﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace EMC.VISITOR.Application
{

    [SugarTable(null, "Flow系統施工单监控日志")]
    [BusinessVS]
    public class FlowSystemSGJK : EntityBase
    {
        /// <summary>
        /// 工程主辦部門
        /// </summary>
        [SugarColumn(ColumnDescription = "工程主辦部門", IsNullable = true)]
        public string req_dept { get; set; }
        /// <summary>
        /// 工程主辦部門名稱
        /// </summary>
        [SugarColumn(ColumnDescription = "工程主辦部門名稱", IsNullable = true)]
        public string req_dept_name { get; set; }
        /// <summary>
        /// 工程主辦人員
        /// </summary>
        [SugarColumn(ColumnDescription = "工程主辦人員", IsNullable = true)]
        public string req_empl { get; set; }
        /// <summary>
        /// 工程主辦人員姓名
        /// </summary>
        [SugarColumn(ColumnDescription = "工程主辦人員姓名", IsNullable = true)]
        public string req_empl_name { get; set; }
        /// <summary>
        /// 緊急聯絡電話
        /// </summary>
        [SugarColumn(ColumnDescription = "緊急聯絡電話", IsNullable = true)]
        public string req_tel { get; set; }
        /// <summary>
        /// 申請日期
        /// </summary>
        [SugarColumn(ColumnDescription = "申請日期", IsNullable = true)]
        public string req_date { get; set; }

        [SugarColumn(ColumnDescription = "申請日期格式化", IsNullable = true)]
        public DateTime? ReqDateTime { get; set; }
        /// <summary>
        /// 工程名稱
        /// </summary>
        [SugarColumn(ColumnDescription = "工程名稱", IsNullable = true, Length = 1000, IndexGroupNameList = new string[] { "index_pname" })]
        public string project_name { get; set; }
        /// <summary>
        /// 施工開始時間
        /// </summary>
        [SugarColumn(ColumnDescription = "施工開始時間", IsNullable = true)]
        public string begin_date { get; set; }
        /// <summary>
        /// 施工結束時間
        /// </summary>
        [SugarColumn(ColumnDescription = "施工結束時間", IsNullable = true)]
        public string end_date { get; set; }

        [SugarColumn(ColumnDescription = "施工開始時間", IsNullable = true, IndexGroupNameList = new string[] { "index_begindate" })]
        public DateTime? BeginDateTime { get; set; }
        [SugarColumn(ColumnDescription = "施工結束時間", IsNullable = true)]
        public DateTime? EndDateTime { get; set; }
        /// <summary>
        /// 施工內容說明
        /// </summary>
        [SugarColumn(ColumnDescription = "施工內容說明", IsNullable = true, Length = 3000)]
        public string content_desc { get; set; }
        /// <summary>
        /// 施工區域部門
        /// </summary>
        [SugarColumn(ColumnDescription = "施工區域部門", IsNullable = true)]
        public string build_dept { get; set; }
        /// <summary>
        /// 施工區域部門名稱
        /// </summary>
        [SugarColumn(ColumnDescription = "施工區域部門名稱", IsNullable = true)]
        public string build_dept_name { get; set; }
        /// <summary>
        /// 施工區域現場負責人
        /// </summary>
        [SugarColumn(ColumnDescription = "施工區域現場負責人", IsNullable = true)]
        public string build_empl { get; set; }
        /// <summary>
        /// 施工區域現場負責人姓名
        /// </summary>
        [SugarColumn(ColumnDescription = "施工區域現場負責人姓名", IsNullable = true)]
        public string build_empl_name { get; set; }
        /// <summary>
        /// 施工緊急聯絡電話
        /// </summary>
        [SugarColumn(ColumnDescription = "施工緊急聯絡電話", IsNullable = true)]
        public string build_tel { get; set; }
        /// <summary>
        /// 承攬廠商名稱
        /// </summary>
        [SugarColumn(ColumnDescription = "承攬廠商名稱", IsNullable = true, IndexGroupNameList = new string[] { "index_supname" })]
        public string supplier_name { get; set; }
        /// <summary>
        /// 承攬商現場負責人
        /// </summary>
        [SugarColumn(ColumnDescription = "承攬商現場負責人", IsNullable = true)]
        public string supplier_empl { get; set; }
        /// <summary>
        /// 承攬商緊急聯絡電話
        /// </summary>
        [SugarColumn(ColumnDescription = "承攬商緊急聯絡電話", IsNullable = true)]
        public string supplier_tel { get; set; }
        /// <summary>
        /// 進廠人員姓名
        /// </summary>
        [SugarColumn(ColumnDescription = "進廠人員姓名", IsNullable = true)]
        public string person { get; set; }

        [SugarColumn(ColumnDescription = "施工人员数量", IsNullable = true)]
        public int vcou { get; set; }
        [SugarColumn(ColumnDescription = "施工人员信息", IsNullable = true, Length = 1000)]
        public string personlist { get; set; }

        [SugarColumn(ColumnDescription = "补充人员", IsNullable = true, Length = 300)]
        public string bcpersonlist { get; set; }
        [SugarColumn(ColumnDescription = "详细内容", IsNullable = true, Length = 1000)]
        public string Content { get; set; }
        [SugarColumn(ColumnDescription = "工作进度", IsNullable = true, Length = 1000)]
        public string Progress { get; set; }
        [SugarColumn(ColumnDescription = "待改善项目", IsNullable = true, Length = 1000)]
        public string ChangeProject { get; set; }
        [SugarColumn(ColumnDescription = "照片", IsNullable = true, Length = 2000)]
        public string Images { get; set; }
        [SugarColumn(ColumnDescription = "施工人员入厂时间", IsNullable = true)]
        public DateTime? EnterTime { get; set; }
        public List<string> GetPersonList()
        {
            if (personlist.IsNullOrEmpty())
                return new List<string>();

            var list = personlist.Split(',').ToList();
            if (!bcpersonlist.IsNullOrEmpty())
                list.AddRange(bcpersonlist.Replace("，", "").Replace(" ", "").Split(',').ToList());

            return list;
        }
    }
}
